package mac.eventRecognizer.pedlParser;

/** This class contains 7 arithmetic operators- +,-,*,/,%,<<,>> - on 5 types: 
 * Integer, Long, Float, Double and Char.  These operators are used for
 * evaluating ASTExpression node.  Some of combination is not valid, for
 * example 5 << 3.3 is not valid. 
 *
 * note.  all possible combinations are not examined enough.  we have to do
 * it later
 *
 * @version 0.1
 * @author Moonjoo Kim
 */
class ASTExpressionAux {
 /* Integer vs other type */
 static Object evalValAux(Integer lv, Integer rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : 
	     result = new Integer(lv.intValue() + rv.intValue()); break;
	 case ASTExpression.SUBTRACT : 
	     result = new Integer(lv.intValue() - rv.intValue()); break;
	 case ASTExpression.MOD	:
	     result = new Integer(lv.intValue() % rv.intValue()); break;
	 case ASTExpression.MULTIPLY : 
	     result = new Integer(lv.intValue() * rv.intValue()); break;
	 case ASTExpression.DIVIDE : 
	     result = new Integer( lv.intValue() / rv.intValue()); break;
	 case ASTExpression.LSHIFT : 
	     result = new Integer( lv.intValue() << rv.intValue()); break;
	 case ASTExpression.RSHIFT : 
	     result = new Integer( lv.intValue() >> rv.intValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Integer lv, Long rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : 
	     result = new Long(lv.intValue() + rv.longValue());break;
	 case ASTExpression.SUBTRACT : 
	     result = new Long(lv.intValue() - rv.longValue());break;
	 case ASTExpression.MOD	:
	     result = new Long(lv.intValue() % rv.longValue()); break;
	 case ASTExpression.MULTIPLY : 
	     result = new Long(lv.intValue() * rv.longValue());break;
	 case ASTExpression.DIVIDE : 
	     result = new Long(lv.intValue() / rv.longValue());break;
	 case ASTExpression.LSHIFT : 
	     result = new Long(lv.intValue() << rv.longValue());break;
	 case ASTExpression.RSHIFT: 
	     result = new Long(lv.intValue() >> rv.longValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Integer lv, Float rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.intValue() + rv.floatValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.intValue() - rv.floatValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.intValue() * rv.floatValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.intValue() / rv.floatValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.intValue() << rv.floatValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.intValue() >> rv.floatValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Integer lv, Double rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.intValue() + rv.doubleValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.intValue() - rv.doubleValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.intValue() * rv.doubleValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.intValue() / rv.doubleValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.intValue() << rv.doubleValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.intValue() >> rv.doubleValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Integer lv, Character rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Integer(lv.intValue() + rv.charValue()); break;
	 case ASTExpression.SUBTRACT : result = new Integer(lv.intValue() - rv.charValue());break;
	 case ASTExpression.MULTIPLY : result = new Integer(lv.intValue() * rv.charValue()); break;
	 case ASTExpression.DIVIDE : result = new Integer(lv.intValue() / rv.charValue());break;
	 case ASTExpression.LSHIFT : result = new Integer(lv.intValue() << rv.charValue());break;
	 case ASTExpression.RSHIFT: result = new Integer(lv.intValue() >> rv.charValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }

 /* Long vs other type */
static Object evalValAux(Long lv, Integer rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Long(lv.longValue() + rv.intValue()); break;
	 case ASTExpression.SUBTRACT : result = new Long(lv.longValue() - rv.intValue()); break;
	 case ASTExpression.MULTIPLY : result = new Long(lv.longValue() * rv.intValue()); break;
	 case ASTExpression.DIVIDE : result = new Long(lv.longValue() / rv.intValue()); break;
	 case ASTExpression.LSHIFT : result = new Long(lv.longValue() << rv.intValue()); break;
	 case ASTExpression.RSHIFT : result = new Long(lv.longValue() >> rv.intValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Long lv, Long rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Long(lv.longValue() + rv.longValue()); break;
	 case ASTExpression.SUBTRACT : result = new Long(lv.longValue() - rv.longValue());break;
	 case ASTExpression.MULTIPLY : result = new Long(lv.longValue() * rv.longValue()); break;
	 case ASTExpression.DIVIDE : result = new Long(lv.longValue() / rv.longValue());break;
	 case ASTExpression.LSHIFT : result = new Long(lv.longValue() << rv.longValue());break;
	 case ASTExpression.RSHIFT: result = new Long(lv.longValue() >> rv.longValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Long lv, Float rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.longValue() + rv.floatValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.longValue() - rv.floatValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.longValue() * rv.floatValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.longValue() / rv.floatValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.longValue() << rv.floatValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.longValue() >> rv.floatValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Long lv, Double rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.longValue() + rv.doubleValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.longValue() - rv.doubleValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.longValue() * rv.doubleValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.longValue() / rv.doubleValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.longValue() << rv.doubleValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.longValue() >> rv.doubleValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Long lv, Character rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Long(lv.longValue() + rv.charValue()); break;
	 case ASTExpression.SUBTRACT : result = new Long(lv.longValue() - rv.charValue());break;
	 case ASTExpression.MULTIPLY : result = new Long(lv.longValue() * rv.charValue()); break;
	 case ASTExpression.DIVIDE : result = new Long(lv.longValue() / rv.charValue());break;
	 case ASTExpression.LSHIFT : result = new Long(lv.longValue() << rv.charValue());break;
	 case ASTExpression.RSHIFT: result = new Long(lv.longValue() >> rv.charValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 /* Float vs other type */
static Object evalValAux(Float lv, Integer rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.floatValue() + rv.intValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.floatValue() - rv.intValue()); break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.floatValue() * rv.intValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.floatValue() / rv.intValue()); break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.floatValue() << rv.intValue()); break;
	 //case ASTExpression.RSHIFT : result = new Float(lv.floatValue() >> rv.intValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Float lv, Long rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.floatValue() + rv.longValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.floatValue() - rv.longValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.floatValue() * rv.longValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.floatValue() / rv.longValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.floatValue() << rv.longValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.floatValue() >> rv.longValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Float lv, Float rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.floatValue() + rv.floatValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.floatValue() - rv.floatValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.floatValue() * rv.floatValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.floatValue() / rv.floatValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.floatValue() << rv.floatValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.floatValue() >> rv.floatValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Float lv, Double rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.floatValue() + rv.doubleValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.floatValue() - rv.doubleValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.floatValue() * rv.doubleValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.floatValue() / rv.doubleValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.floatValue() << rv.doubleValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.floatValue() >> rv.doubleValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Float lv, Character rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Float(lv.floatValue() + rv.charValue()); break;
	 case ASTExpression.SUBTRACT : result = new Float(lv.floatValue() - rv.charValue());break;
	 case ASTExpression.MULTIPLY : result = new Float(lv.floatValue() * rv.charValue()); break;
	 case ASTExpression.DIVIDE : result = new Float(lv.floatValue() / rv.charValue());break;
	 //case ASTExpression.LSHIFT : result = new Float(lv.floatValue() << rv.charValue());break;
	 //case ASTExpression.RSHIFT: result = new Float(lv.floatValue() >> rv.charValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }

 // Double vs other type 
static Object evalValAux(Double lv, Integer rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.doubleValue() + rv.intValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.doubleValue() - rv.intValue()); break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.doubleValue() * rv.intValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.doubleValue() / rv.intValue()); break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.doubleValue() << rv.intValue()); break;
	 //case ASTExpression.RSHIFT : result = new Double(lv.doubleValue() >> rv.intValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Double lv, Long rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.doubleValue() + rv.longValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.doubleValue() - rv.longValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.doubleValue() * rv.longValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.doubleValue() / rv.longValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.doubleValue() << rv.longValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.doubleValue() >> rv.longValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Double lv, Float rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.doubleValue() + rv.floatValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.doubleValue() - rv.floatValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.doubleValue() * rv.floatValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.doubleValue() / rv.floatValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.doubleValue() << rv.floatValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.doubleValue() >> rv.floatValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Double lv, Double rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.doubleValue() + rv.doubleValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.doubleValue() - rv.doubleValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.doubleValue() * rv.doubleValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.doubleValue() / rv.doubleValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.doubleValue() << rv.doubleValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.doubleValue() >> rv.doubleValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Double lv, Character rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = new Double(lv.doubleValue() + rv.charValue()); break;
	 case ASTExpression.SUBTRACT : result = new Double(lv.doubleValue() - rv.charValue());break;
	 case ASTExpression.MULTIPLY : result = new Double(lv.doubleValue() * rv.charValue()); break;
	 case ASTExpression.DIVIDE : result = new Double(lv.doubleValue() / rv.charValue());break;
	 //case ASTExpression.LSHIFT : result = new Double(lv.doubleValue() << rv.charValue());break;
	 //case ASTExpression.RSHIFT: result = new Double(lv.doubleValue() >> rv.charValue());break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }

 /*
 // Character vs other type 
static Object evalValAux(Character lv, Integer rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = lv.charValue() + rv.intValue(); break;
	 case ASTExpression.SUBTRACT : result = lv.charValue() - rv.intValue(); break;
	 case ASTExpression.MULTIPLY : result = lv.charValue() * rv.intValue(); break;
	 case ASTExpression.DIVIDE : result = lv.charValue() / rv.intValue(); break;
	 case ASTExpression.LSHIFT : result = lv.charValue() << rv.intValue(); break;
	 case ASTExpression.RSHIFT : result = lv.charValue() >> rv.intValue();break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Character lv, Long rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = lv.charValue() + rv.longValue(); break;
	 case ASTExpression.SUBTRACT : result = lv.charValue() - rv.longValue();break;
	 case ASTExpression.MULTIPLY : result = lv.charValue() * rv.longValue(); break;
	 case ASTExpression.DIVIDE : result = lv.charValue() / rv.longValue();break;
	 case ASTExpression.LSHIFT : result = lv.charValue() << rv.longValue();break;
	 case ASTExpression.RSHIFT: result = lv.charValue() >> rv.longValue();break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Character lv, Float rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = lv.charValue() + rv.floatValue(); break;
	 case ASTExpression.SUBTRACT : result = lv.charValue() - rv.floatValue();break;
	 case ASTExpression.MULTIPLY : result = lv.charValue() * rv.floatValue(); break;
	 case ASTExpression.DIVIDE : result = lv.charValue() / rv.floatValue();break;
	 case ASTExpression.LSHIFT : result = lv.charValue() << rv.floatValue();break;
	 case ASTExpression.RSHIFT: result = lv.charValue() >> rv.floatValue();break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Character lv, Double rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = lv.charValue() + rv.doubleValue(); break;
	 case ASTExpression.SUBTRACT : result = lv.charValue() - rv.doubleValue();break;
	 case ASTExpression.MULTIPLY : result = lv.charValue() * rv.doubleValue(); break;
	 case ASTExpression.DIVIDE : result = lv.charValue() / rv.doubleValue();break;
	 case ASTExpression.LSHIFT : result = lv.charValue() << rv.doubleValue();break;
	 case ASTExpression.RSHIFT: result = lv.charValue() >> rv.doubleValue();break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 static Object evalValAux(Character lv, Character rv, int op) {
     Object result = null;
     switch(op) {
	 case ASTExpression.ADD : result = lv.charValue() + rv.charValue(); break;
	 case ASTExpression.SUBTRACT : result = lv.charValue() - rv.charValue();break;
	 case ASTExpression.MULTIPLY : result = lv.charValue() * rv.charValue(); break;
	 case ASTExpression.DIVIDE : result = lv.charValue() / rv.charValue();break;
	 case ASTExpression.LSHIFT : result = lv.charValue() << rv.charValue();break;
	 case ASTExpression.RSHIFT: result = lv.charValue() >> rv.charValue();break;
	 default: System.err.println("Incorrect operator type : " + op );
		  break;
     }
     return result;
 }
 */

     // Dumb function for compiling
 static Object evalValAux(Object lv, Object rv, int op) {
     Object result = null;
     return result;
 }

 /**
  * This method evaluates relation between two Objects which are one of
  * Integer, Long, Float, Double and Character with given <code> op </code>
  * which indicates what relational function is applied.  What this method
  * actually does is to recognize types of two arguments and calls 
  * <code>evalValAux</code> with passing these two arguments.
  */
 static Object evalValue(Object lv, Object rv, int op) {
     Object result=null;
     if( lv instanceof Integer) { 	// Integer vs other type 
	 if( rv instanceof Integer) { 
	     result = ASTExpressionAux.evalValAux((Integer)lv,(Integer)rv,op);
	 } else if( rv instanceof Long) {
	     result = ASTExpressionAux.evalValAux((Integer)lv,(Long)rv,op);
	 } else if( rv instanceof Float) {
	     result = ASTExpressionAux.evalValAux((Integer)lv,(Float)rv,op);
	 } else if( rv instanceof Double) {
	     result = ASTExpressionAux.evalValAux((Integer)lv,(Double)rv,op);
	 } else if( rv instanceof Character) {
	     result = ASTExpressionAux.evalValAux((Integer)lv,(Character)rv,op);
	 } else { System.err.println("evalRelation has unexpected operands");
	 }
     } else if( lv instanceof Long) {	// Long vs other type
	 if( rv instanceof Integer) { 
	     result = ASTExpressionAux.evalValAux((Long)lv,(Integer)rv,op);
	 } else if( rv instanceof Long) {
	     result = ASTExpressionAux.evalValAux((Long)lv,(Long)rv,op);
	 } else if( rv instanceof Float) {
	     result = ASTExpressionAux.evalValAux((Long)lv,(Float)rv,op);
	 } else if( rv instanceof Double) {
	     result = ASTExpressionAux.evalValAux((Long)lv,(Double)rv,op);
	 } else if( rv instanceof Character) {
	     result = ASTExpressionAux.evalValAux((Long)lv,(Character)rv,op);
	 } else { System.err.println("evalRelation has unexpected operands");
	 }
     } else if( lv instanceof Float) {	// Float vs other type
	 if( rv instanceof Integer) { 
	     result = ASTExpressionAux.evalValAux((Float)lv,(Integer)rv,op);
	 } else if( rv instanceof Long) {
	     result = ASTExpressionAux.evalValAux((Float)lv,(Long)rv,op);
	 } else if( rv instanceof Float) {
	     result = ASTExpressionAux.evalValAux((Float)lv,(Float)rv,op);
	 } else if( rv instanceof Double) {
	     result = ASTExpressionAux.evalValAux((Float)lv,(Double)rv,op);
	 } else if( rv instanceof Character) {
	     result = ASTExpressionAux.evalValAux((Float)lv,(Character)rv,op);
	 } else { System.err.println("evalRelation has unexpected operands");
	 }
     } else if( lv instanceof Double) {	// Double vs other type
	 if( rv instanceof Integer) { 
	     result = ASTExpressionAux.evalValAux((Double)lv,(Integer)rv,op);
	 } else if( rv instanceof Long) {
	     result = ASTExpressionAux.evalValAux((Double)lv,(Long)rv,op);
	 } else if( rv instanceof Float) {
	     result = ASTExpressionAux.evalValAux((Double)lv,(Float)rv,op);
	 } else if( rv instanceof Double) {
	     result = ASTExpressionAux.evalValAux((Double)lv,(Double)rv,op);
	 } else if( rv instanceof Character) {
	     result = ASTExpressionAux.evalValAux((Double)lv,(Character)rv,op);
	 } else { System.err.println("evalRelation has unexpected operands");
	 }
     } else if( lv instanceof Character) {// Character vs other type
	 if( rv instanceof Integer) { 
	     result = ASTExpressionAux.evalValAux((Character)lv,(Integer)rv,op);
	 } else if( rv instanceof Long) {
	     result = ASTExpressionAux.evalValAux((Character)lv,(Long)rv,op);
	 } else if( rv instanceof Float) {
	     result = ASTExpressionAux.evalValAux((Character)lv,(Float)rv,op);
	 } else if( rv instanceof Double) {
	     result = ASTExpressionAux.evalValAux((Character)lv,(Double)rv,op);
	 } else if( rv instanceof Character) {
	     result = ASTExpressionAux.evalValAux((Character)lv,(Character)rv,op);
	 } else { System.err.println("evalRelation has unexpected operands");
	 }
     } else { System.err.println("evalRelation has unexpected operands");
     }
     return result;
 }
}
